#pragma warning disable 108
using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using Cephei;
using Cephei.Core;
using Cephei.Core.Generic;
using Microsoft.FSharp.Core;
namespace Cephei.QL.Math.Optimization
{
    /// <summary> 
	/// ! - maximum number of iterations AND minimum number of iterations around stationary point - x (independent variable) stationary point - y=f(x) (dependent variable) stationary point - stationary gradient
	/// </summary>
    [Guid ("EFE98F1A-BF37-4e24-8A08-7896942178AE"),ComVisible(true)]
	public interface IEndCriteria 
	{
		///////////////////////////////////////////////////////////////
        // Methods
        //
        /// <summary> 
		/// 
		/// </summary>
		 Boolean CheckMaxIterations(UInt64 iteration, QL.Math.Optimization.EndCriteria.TypeEnum ecType);
        /// <summary> 
		/// 
		/// </summary>
		 Boolean CheckStationaryFunctionAccuracy(Double f, Boolean positiveOptimization, QL.Math.Optimization.EndCriteria.TypeEnum ecType);
        /// <summary> 
		/// 
		/// </summary>
		 Boolean CheckStationaryFunctionValue(Double fxOld, Double fxNew, UInt64 statStateIterations, QL.Math.Optimization.EndCriteria.TypeEnum ecType);
        /// <summary> 
		/// 
		/// </summary>
		 Boolean CheckStationaryPoint(Double xOld, Double xNew, UInt64 statStateIterations, QL.Math.Optimization.EndCriteria.TypeEnum ecType);
        /// <summary> 
		/// bool EndCriteria::checkZerGradientNormValue( const Real gNormOld, const Real gNormNew, EndCriteria::Type& ecType) const { if (std::fabs(gNormNew-gNormOld) >= gradientNormEpsilon_) return false; ecType = StationaryGradient; return true; }
		/// </summary>
		 Boolean CheckZeroGradientNorm(Double gNorm, QL.Math.Optimization.EndCriteria.TypeEnum ecType);
        /// <summary> 
		/// 
		/// </summary>
		 Double FunctionEpsilon {get;}
        /// <summary> 
		/// 
		/// </summary>
		 Double GradientNormEpsilon {get;}
        /// <summary> 
		/// Inspectors
		/// </summary>
		 UInt64 MaxIterations {get;}
        /// <summary> 
		/// 
		/// </summary>
		 UInt64 MaxStationaryStateIterations {get;}
        /// <summary> 
		/// 
		/// </summary>
		 Double RootEpsilon {get;}
    }   

    /// <summary> 
	/// ! - maximum number of iterations AND minimum number of iterations around stationary point - x (independent variable) stationary point - y=f(x) (dependent variable) stationary point - stationary gradient Factory
	/// </summary>
   	[ComVisible(true)]
    public interface IEndCriteria_Factory 
    {
        ///////////////////////////////////////////////////////////////
        // Factory methods
        //
        /// <summary> 
		/// 
		/// </summary>
	    IEndCriteria Create (UInt64 maxIterations, UInt64 maxStationaryStateIterations, Double rootEpsilon, Double functionEpsilon, Double gradientNormEpsilon);
    }
}

